/*
 * GeoVISTA Center (Penn State, Dept. of Geography)
 * Copyright (c), 2003-2011,  Jin Chen and Alan M. MacEachren, GeoVISTA Center, Penn State University
 * All Rights Researved.
 *
 * This library is developed and distributed for free usage,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * You can redistribute and/or modify it under the terms of the
 * Simplified BSD License
 *
 *
 *
 *
 *
 *
 *
 *
 * @Original Author: jin Chen
 * @date: Apr 12, 2004$
 * @version: 1.0
 */
package edu.psu.geovista.app.dataloader.v1.actions;

import edu.psu.geovista.app.dataloader.v1.DataLoaders;

import java.awt.event.ActionEvent;
import java.util.Properties;

public class SelectAttrs90 extends BasicAction{
    public SelectAttrs90() {
    }

    public SelectAttrs90(String name, DataLoaders dl) {
        super(name, dl);
    }

    public void actionPerformed(ActionEvent e) {
        processInfoFromPreviousPage();

        boolean success = processInfoForNextPage() ;

        if (success) {
            doNext();
            //dataloader.showAttributesDlg();
        }
    }
    protected void processInfoFromPreviousPage(){
        //1. update path info into wizard, it is for taking a new project paths or update exisint project paths
        edu.psu.geovista.app.dataloader.v1.components.PcpDataLoader pcp=dataloader.getPcpload();
        edu.psu.geovista.app.dataloader.v1.components.TsDataLoader ts=dataloader.getTsload();
        //ProjectType proj=wizard.getProject();

        if(wizardData.isLoadPcpdata()) {
            //pcp.fillProjectInfo(proj.getPcpdata());  
            Properties paths=pcp.getFileLoaderValues(); // //
            //dataloader.getPathsPane()
            wizardData.setPcpPaths(paths);
            wizardData.setProjectedData(pcp.getProjectCheck().isSelected() );

        }
        if(wizardData.isLoadTsdata() ){
            //ts.fillProjectInfo(proj.getTsdata());
            Properties paths=ts.getFileLoaderValues();
                    wizardData.setTsPaths(paths);

                }

    }

    protected boolean processInfoForNextPage(){

         return dataloader.autoSelectAttributes() ;
    }

    protected void doNext(){
        dataloader.showAttributesDlg();
    }
}
